--[[ 编码: WMS-19-02 名称: 容器货品明细-码盘-容器编码输入后 作者:HAN 日期:2025-1-29 级别:固定 (说明本段代码在项目中不太会变化) 函数: AfterCNTRNumChange 功能: -- 在码盘界面,输入容器编号后,系统获取该容器已经绑定的货品清单,并且返回给前端界面进行显示 更改记录: --]] wms_cntr= require( "wms_container" ) function AfterCNTRNumChange ( strLuaDEID ) local nRet, strRetInfo local attrs -- step1 获取5600码盘界面中表头界面的输入参数(容器编号/托盘号) nRet, attrs = m3.GetSysInputParameter( strLuaDEID ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前输入面板里的属性失败! "..attrs ) end local input_attr = m3.KeyValueAttrsToObjAttr(attrs) local cntr_code = input_attr.S_CNTR_CODE if (cntr_code == nil or cntr_code == '') then return end -- step2 判断输容器是否存在合法 local container nRet, container = wms_cntr.GetInfo( strLuaDEID, cntr_code ) if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), "获取【容器】信息失败! " .. container) end if ( container == '') then lua.Error( strLuaDEID, debug.getinfo(1), "【容器】" .. cntr_code.."不存在!") end if ( container.virtual == 'Y' ) then lua.Error( strLuaDEID, debug.getinfo(1), "容器'" .. cntr_code.."'是一个虚拟容器!") end -- step3 查询该容器编号里是否有绑定了货品 -- 查询【容器货品明细】 local strCondition = "S_CNTR_CODE = '"..cntr_code.."'" local strOrder = "T_CREATE" -- 根据创建时间进行排序 nRet, cg_detail = m3.QueryDataObject( strLuaDEID, "CG_Detail", strCondition, strOrder ) if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), "获取【容器货品明细】信息失败! " .. cg_detail) end -- 设置《已码盘》页面信息 local strDataJson, strAction if ( #cg_detail == 0 ) then strDataJson = '{"page_name":"已码盘","clear":true,"content":[]}' else strDataJson = '{"page_name":"已码盘","clear":true,"content":'..lua.table2str(cg_detail)..'}' end strAction = '[{"action_type":"set_subtable_page_content","value":'..strDataJson..'}]' nRet, strRetInfo = mobox.setAction( strLuaDEID, strAction ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction失败! "..strRetInfo..' action = '..strAction ) end end